package cn.wolfcode.luowowo.article.service.impl;

import cn.wolfcode.luowowo.article.domain.AnswerComment;
import cn.wolfcode.luowowo.article.domain.Questions;
import cn.wolfcode.luowowo.article.mapper.QuestionsMapper;
import cn.wolfcode.luowowo.article.query.QuestionsQuery;
import cn.wolfcode.luowowo.article.service.IQuestionsService;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;
import java.util.List;

@Service
public class QuestionsServiceImpl implements IQuestionsService{

    @Autowired
    private QuestionsMapper questionsMapper;



    @Override
    public PageInfo query(QuestionsQuery qo) {
        PageHelper.startPage( qo.getCurrentPage(), qo.getPageSize() );
        return new PageInfo( questionsMapper.selectForList( qo ));
    }


    @Override
    public Long save(Questions questions) {
        questionsMapper.insert(questions);
        return questions.getId();
    }



    @Override
    public Questions get(Long id) {
        return questionsMapper.selectByPrimaryKey(id);
    }


    @Override
    public List<Questions> viewnumTop() {
        return questionsMapper.selectviewnumTop();
    }

    @Override
    public List<Questions> sharenumTop() {
        return questionsMapper.selectSharenumTop();
    }

    @Override
    public List<Questions> thumbsupnumTop() {
        return questionsMapper.selectthumbsupnumTop();
    }


}
